//
//  main.cpp
//  类的静态成员
//
//  Created by linjinzhu on 2017/7/11.
//  Copyright © 2017年 baidu. All rights reserved.
//

#include <iostream>

using namespace std;

class Box {

private:
    int x,y,z;

public:
    Box(int _x=1, int _y=2, int _z=3) {
        x = _x;
        y = _y;
        z = _z;
        ++objectCount;
    }
    int volume() {
        return x*y*z;
    }

    static int objectCount;
    static int getCount();
};

int Box::objectCount = 0;

int Box::getCount() {
    return objectCount;
}

int main(int argc, const char * argv[]) {

    cout << "object count : " << Box::getCount() << endl;
    Box b1(3,3,3);
    Box b2(3,3,3);
    b2.volume();
    cout << "object count : " << Box::getCount() << endl;


    return 0;
}
